import { observable, action, computed, runInAction, autorun, when, reaction } from "mobx"
// import { getMaxListeners } from "cluster";
import { list } from "_postcss@7.0.17@postcss";
// import axios from "axios"
class SearchStore{
<<<<<<< HEAD
    @observable count=10;


=======
>>>>>>> 3ef2a7301991405f246e5687924fdd0e40607de4
    @observable seachsongs=['seachsongs']
    @observable seachsingers = ["seachsingers"]
    @observable seachsingers2 = ["seachsingers2"]
  constructor(store){
      this.store=store
  }
  @action.bound getresultList(value){
      fetch("https://v1.itooi.cn/netease/search?keyword="+value+"&type=song")
      .then(body=>body.json())
      .then(data=>{
          this.setresultList(data.data)
          // console.log(data.data)
      })


  }
  @action.bound setresultList(list){
      this.seachsongs=list
      // console.log(this.songs)
  }
  @action.bound getresultList2(){
  fetch("https://v1.itooi.cn/netease/artist/top?page=0&pageSize=8")
  .then(body => body.json())
  .then(data => {
  this.setresultList2(data.data)
//   console.log(data.data)
  })
  }
  @action.bound setresultList2(list){
  this.seachsingers = [...list]
//   console.log(this.singers)
  }
  @action.bound getresultList3(id){
    fetch("https://v1.itooi.cn/netease/song/artist?id="+id)
    .then(body => body.json())
    .then(data => {
    this.setresultList3(data.data)
    // console.log(data.data)
    })
    }
    @action.bound setresultList3(list){
    this.seachsingers2 = [...list]
    // console.log(this.singers2)
    }
}
export default SearchStore